home *** CD-ROM | disk | FTP | other *** search
- property ancestor, pPathFunctionData, pCurrentLoc, pStartLoc
- global gCPU
-
- on birth me, arguments
- set the ancestor of me to birth(script "Animator", arguments)
- set the pPathFunctionData of me to the pathData of arguments
- set pStartLoc to the location of arguments
- set pCurrentLoc to pStartLoc
- return me
- end
-
- on moveSprite me
- set theResult to chaoticStockLoc(me)
- set the pCurrentLoc of me to theResult
- set the loc of sprite the pChannel of me to the pCurrentLoc of me
- DrawXLine(me)
- end
-
- on chaoticStockLoc me
- set PresentOBJAnim to getaProp(getaProp(gObjects, #PresentTrendBar), #animator)
- set trendOffsetH to getaProp(getaProp(gObjects, #PresentTrendBar), #trendOffsetH)
- set timePricePlotList to getaProp(getaProp(gObjects, #ShortTermStock), #timePricePlotPoints)
- set lastY to getaProp(getaProp(gObjects, #ShortTermStock), #chaosLastY)
- set PresentLoc to the pCurrentLoc of PresentOBJAnim
- set V to the locV of PresentLoc
- if V < 0 then
- return point(-1000, -1000)
- end if
- set timeInterval to getaProp(getaProp(gObjects, #ShortTermStock), #timeInterval)
- set left to 34
- set height to 39.0
- set bottom to 79
- set top to 40
- set width to 526
- set m to 1
- set stockRef to getaProp(getaProp(gObjects, #ShortStocks), #currentChildDown)
- set chaosGenAList to getaProp(getaProp(gObjects, #ShortTermStock), #chaosGenA)
- set a to getaProp(chaosGenAList, stockRef)
- set trendH to the locH of PresentLoc - trendOffsetH
- if trendH > 526 then
- set trendH to 34 + trendH - 526
- else
- if trendH < 34 then
- set trendH to 526 - (34 - trendH)
- end if
- end if
- if lastY = #NULL then
- set chaosSeedYList to getaProp(getaProp(gObjects, #ShortTermStock), #chaosSeedY)
- set yn to getaProp(chaosSeedYList, stockRef)
- else
- set yn to lastY
- end if
- repeat with i = 1 to integer(timeInterval / 2)
- set yn to a * yn * (1 - yn)
- end repeat
- setaProp(getaProp(gObjects, #ShortTermStock), #chaosLastY, yn)
- set trendV to top + ((1 - yn) * height)
- set trendLoc to point(trendH, trendV)
- updateTimePricePlotPoints(trendLoc)
- return trendLoc
- end
-
- on ranStockloc me
- set startloc to the pCurrentLoc of me
- set V to the locV of startloc
- if V < 0 then
- return point(-1000, -1000)
- end if
- set H to the locH of startloc + 2
- if H > 526 then
- set H to 34
- end if
- if random(2) = 1 then
- set V to V + random(10)
- if V > 79 then
- set V to 79 - random(10)
- end if
- else
- set V to V - random(10)
- if V < 40 then
- set V to 40 + random(10)
- end if
- end if
- set aloc to point(H, V)
- updateTimePricePlotPoints(aloc)
- return aloc
- end
-
- on DrawXLine
- set xLineXOBJ to getaProp(getaProp(gObjects, #TrendPlotter), #LineXOBj)
- set previousPoint to getaProp(getaProp(gObjects, #ShortTermStock), #pricePricePreviousPoint)
- set newPoint to pricePriceLoc()
- if objectp(xLineXOBJ) then
- if gCPU = #mac then
- set colorIndex to getIndex([8: 226, 16: 995, 32: 65305])
- xLineXOBJ(mDrawLine, previousPoint, newPoint, 1, colorIndex)
- else
- if gCPU = #mpc then
- xLineXOBJ(mDrawLine, "stage", previousPoint, newPoint, 1, 29)
- end if
- end if
- end if
- setaProp(getaProp(gObjects, #ShortTermStock), #pricePricePreviousPoint, newPoint)
- end
-
- on pricePriceLoc
- set dataList to getaProp(getaProp(gObjects, #ShortTermStock), #timePricePlotPoints)
- set timeInterval to getaProp(getaProp(gObjects, #ShortTermStock), #timeInterval)
- set locOffset to getaProp(getaProp(gObjects, #ShortTermStock), #pricePriceOriginLoc)
- set pricePriceXScaleFactor to getaProp(getaProp(gObjects, #ShortTermStock), #pricePriceXScaleFactor)
- set pricePriceYScaleFactor to getaProp(getaProp(gObjects, #ShortTermStock), #pricePriceYScaleFactor)
- if count(dataList) > 0 then
- set newPresentCoordinate to getAt(dataList, count(dataList)) * pricePriceXScaleFactor
- else
- set newLoc to point(0, 0) + locOffset
- return newLoc
- end if
- if count(dataList) > timeInterval then
- set newPastCoordinate to getAt(dataList, count(dataList) - (timeInterval - 1)) * pricePriceYScaleFactor * -1
- else
- set newLoc to point(0, 0) + locOffset
- return newLoc
- end if
- set newLoc to point(newPresentCoordinate, newPastCoordinate) + locOffset
- return newLoc
- end
-